package com.eypg.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.eypg.dao.BaseDAO;
import com.eypg.pojo.Productimage;
import com.eypg.service.ProductImageService;
@Service
public class ProductImageServiceImpl implements ProductImageService{
	@Autowired
	@Qualifier("baseDao")
	BaseDAO baseDao;

	public void addProductImage(Productimage productImage) {
		baseDao.saveOrUpdate(productImage);
		
	}

	public String loadProductImageById(String piProductId) {
		String hql = " from Productimage pi where pi.piProductId = '" + piProductId + "'";
		Productimage image = (Productimage)baseDao.loadObject(hql);
		if(image != null){
			return image.getImage();
		}
		return null;
	}
}
